package org.neuedu.chapter09_0630.demo01;

public class StringDemo01 {

    public static boolean isEmpty(String str) {
        return str != null && !"".equals(str.trim());
    }

    public static void main(String[] args) {
        String str = "worldhelloworld";
        String newStr = str.replace('o', 'z');
        System.out.println(newStr);
        // 了解 替换
        String s = str.replaceAll("o", "java7");
        System.out.println(s);
        // 了解 大小写转换
        System.out.println(str.toUpperCase());
        System.out.println(str.toUpperCase().toLowerCase());
        // 判断 字符串以什么开头/结尾
        // boolean startsWith(String str)
        // boolean endsWith(String str)
        System.out.println(str.startsWith("abc"));
        System.out.println(str.endsWith("abc"));

        // 裁剪 String trim()
        System.out.println("         ".trim());
        String world = "hello".concat("world");
    }
}
